#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QUdpSocket>
#include <QJsonObject>
#include <QTimer>
#include "mainwindow1.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_searchButton_clicked();
    void readPendingDatagrams();
    void handleTimeout();
    void changeScreen();
    //xiesi
    void myslot();

private:
    Ui::MainWindow *ui;
    QUdpSocket *udpSocket;
    QTimer *searchTimer;
    MainWindow1 *mainwindow1 = new MainWindow1();
    void logMessage(const QString &message);
    void sendBroadcast();
    void processGatewayResponse(const QJsonObject &json, const QHostAddress &sender);
};

#endif // MAINWINDOW_H
